<?php

//公共代码路径、admin代码路径、user代码路径
define('TOP_DIR', realpath(dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'));
Yii::setPathOfAlias('commonPath', TOP_DIR.DIRECTORY_SEPARATOR.'common');
Yii::setPathOfAlias('adminPath', TOP_DIR.DIRECTORY_SEPARATOR.'admin');
Yii::setPathOfAlias('userPath', TOP_DIR.DIRECTORY_SEPARATOR.'user');

//数据文件路径：上传的图片
Yii::setPathOfAlias('uploadPath', realpath(dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..').DIRECTORY_SEPARATOR.'data'.DIRECTORY_SEPARATOR.'upload');
//日志文件路径
Yii::setPathOfAlias('logPath', realpath(dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..').DIRECTORY_SEPARATOR.'data'.DIRECTORY_SEPARATOR.'log');

//前台页面的WebApp配置
return array(
	//中文简体
	'language'=>'zh_cn',

	//需要预先加载的组件
	'preload'=>array('log'),

	//提前加载的路径
	'import'=>array(
		'application.models.*',
		'application.components.*',
		'commonPath.models.*',
		'commonPath.components.*',
	),

	//设置runtime路径
	'runtimePath'=>Yii::getPathOfAlias('logPath.'.ModelName.'.runtime'),

	//组件配置
	'components'=>array(
		//路由组件
		'urlManager'=>array(
			'urlFormat'=>'path',
			'rules'=>array(
				'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',//通用url规则
			),
			'showScriptName'=>false,
		),
		//日志组件
		'log'=>require(dirname(__FILE__).DIRECTORY_SEPARATOR.'log.php'),
		//缓存组件：使用memcache进行缓存
		/*'cache'=>array(
			'class'=>'CMemCache',
			'servers'=>array(
				array(
					'host'=>'127.0.0.1',
					'port'=>11211
				),
			),
		),*/
		//数据库组件
		'db'=>array(
			'connectionString' => 'mysql:host=localhost;dbname=WuZi',
			'emulatePrepare' => true,
			'username' => 'WuZi',
			'password' => '123456',
			'charset' => 'utf8',
			'enableParamLogging'=>true
		),
		//异常处理组件
		'errorHandler'=>array('errorAction'=>'site/error'),
		//request组件
		//'request'=>array('class'=>'CHttpRequestExt'),
		//安全组件
		'securityManager'=>array(
			'class'=>'CSecurityManager',
			'validationKey'=>'!@#$%QWER?><T!@#$%qwert',
			'encryptionKey'=>'~!@#$%^&*(*&^%$#DSFGH45346',
		),
		//图像处理组件
		'image'=>array(
			'class'=>'commonPath.extensions.image.CImageComponent',
			'driver'=>'GD',
			'pathAlias'=>'commonPath.extensions.image'
		),
		//发送邮件组件
		'email'=>array('class'=>'YiiEmail'),
		'yexcel'=>array(
			'class'=>'commonPath.extensions.yexcel.Yexcel'
		),
	),

	//模块配置
	'modules'=>array(
		'gii'=>array(
			'class'=>'system.gii.GiiModule',
			'password'=>'111111'
		),
	),

	//WebApp的参数
	'params'=>require(dirname(__FILE__).DIRECTORY_SEPARATOR.'params.php')
);